import yaml

def get_yaml_data(yaml_file):
    # 打开yaml文件
    file = open(yaml_file, 'r', encoding="utf-8")
    file_data = file.read()
    file.close()
    # 将字符串转化为字典或列表
    data = yaml.load(file_data,Loader=yaml.FullLoader)
    return data
def save_yame(yaml_file,data):
    file = open(yaml_file, 'w', encoding='utf-8')
    # yaml.dump(data, file, Dumper=yaml.RoundTripDumper)
    yaml.safe_dump(data,file,encoding='utf-8', allow_unicode=True)
    file.close()
